<?php

class ThongkeController extends Zend_Controller_Action
{
    

    public function init()
    {
        /* Initialize action controller here */
    }
    public function preDispatch() 
    {
        $auth = Zend_Auth::getInstance();
        if (!$auth->hasIdentity()) {
            if ($this->_request->getActionName() != 'login') {
                $this->_redirect('/user/login');
            }
        }
    }
    public function indexAction()
    {
        //Lay bang 1
        $stockdate = new Application_Model_StockDate();
        $calrisk = new Application_Model_CalRisk();
        $results = $calrisk->fetchAll('ret_12m > -100', 'ret_12m DESC', 10);
        $this->view->results = $results; 
        
        //Lay bang 2 va bang 3
        $where = array();
        $result2 = $calrisk->fetchAll($where, 'von_thi_truong DESC', 10);
        $this->view->result2 = $result2; 
        
        //Lay bang 4
        $where = array();
        $result4 = $calrisk->fetchAll($where, 'volume_12m DESC', 10);
        $this->view->result4 = $result4;
    }
}
